<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%@ include  file="/jsps/common/taglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>小麦铺</title>
<link href="<c:url value="/css/base.css"/>" rel="stylesheet" type="text/css" />
<link href="<c:url value="/css/shoppingCart_page.css"/>" rel="stylesheet" type="text/css" />
<link rel="stylesheet" type="text/css" href="<c:url value="/css/pro_dropdown_2.css"/>" />

	<script type="text/javascript" src="<c:url value="/js/jquery.js"/>"></script>
	<script type="text/javascript" src="<c:url value="/js/payfor.js"/>"></script>
	<script type="text/javascript">
		 
		function onlynumber() {
			if (event.keyCode==13){
				return true;
			}
			if (event.keyCode<48||event.keyCode>57){
				event.keyCode=0;
				event.returnValue=false;
			}
			event.returnValue=true;
		}

	    var prices=0;
	    function accountPrice(id,i) {
	    	// alert("$n(quantity,0).value:"+$n("quantity",0).value);
	    	var num=$n("quantity",i).value;
	    	//alert("num:"+num);
	    	// alert("num*price:"+num*price);
	    	// alert("$(totalPrices):"+$("totalPrices"));
	    	// $("totalPrices").innerText=num*price;
	    	// prices+=num*price;
	    	location.href="<c:url value="/goodMgr?act=setQuantity&id="/>"+id+"&quantity="+num;
	    };
	    
	    function getPrices() {
	    var prices=0;
	    	$("totalPrices").innerText=prices.toFixed(1);
	    };
	    
	    function setNewItemAmount(goodsid,amount,totalAmount)
	    {
	       //alert(totalAmount);
	       if(amount<1 || totalAmount<amount)
	       {
	            alert("请输入1--"+totalAmount+"的整数!");
	            location.href="<c:url value="/goodMgr?act=refresh"/>";
	       }
	       else 
	       location.href="<c:url value="/goodMgr?act=setNewItemAmount&goodNo="/>"+goodsid+"&cnt="+amount;
	    };
	    
	   function removeGoodFromCar(goodsid,goodsname)
	    {
	    	alert("dd");
	      if(confirm("您真的要删除购物车中的商品条目["+goodsname+"]吗?"))
	        location.href="<c:url value="/goodMgr?act=removeGoodFromCar&goodNo="/>"+goodsid;
	   }
	   
	    function setAmount.reduce(goodsid,index){
	       var amount=document.getElementById('goodNum'+index).value;
	         //alert(amount);
	         amount--;
	         if(amount<1)
	           alert("你输入的值要大于等于1!");
	         else 
	        location.href="<c:url value="/goodMgr?act=setNewItemAmount&goodNo="/>"+goodsid+"&cnt="+amount;
	    }
	 function setAmount.add(goodsid,totalAmount,index){
	 	alert("aa");
	       var amount=document.getElementById('goodNum'+index).value;
	       //alert(amount);
	         amount++;
	       //alert(totalAmount);
	         
	         if(amount>totalAmount)
	           alert("你输入的值要小于等于"+totalAmount+"件!");
	         else 
	        location.href="<c:url value="/goodMgr?act=setNewItemAmount&goodNo="/>"+goodsid+"&cnt="+amount;
	    }

	   
</script>
</head>
<body>
<!-- 要跳转的url -->
<input type="hidden" id="geturl"/>

<div class="box">
<!--[if !IE]>头部<![endif]-->
  <div class="ctop">
	    <div class="top_con">
		      <div class="top_ctext">
			    	您好 
				    <c:if test="${loginCustomer!=null }">
				      	<a href="" target="_blank">${loginCustomer.code }</a>
				    </c:if>  ，欢迎光临小麦铺！      
			    </div>
			    <c:if test="${loginCustomer!=null }">
				    <div id="menu" style="padding-top:4px;">
					    <ul>
						    <li class="solutions"><a href="" onclick="loginOut()">退出</a></li>
					    </ul>
				    </div> 
			    </c:if>
			   
		      
		      <div class="top_ctext2"><span class="ys1"><a href="<c:url value="frontUserMgr?act=toMyshop"/>">我的小麦铺</a> |</span>
		      <span class="ys2"><img src="${ctx }/img/a1.jpg" /></span>
		     
      	     
		      </div>
	    </div>

    <div class="top_logo">
      <div class="topf">
       

  <!--[if !IE]>中间<![endif]-->
  <div class="content">
   <!--[if !IE]>购物车列表<![endif]-->
   <div class="shopcart1">
   <table width="1200" border="0" cellspacing="40" cellpadding="40">
  <tr>
    <td width="20" height="30" valign="middle" class="shopcartys"></td>
    <td width="360" valign="middle" class="shopcartys" align="left">产品</td>
    <td width="120" align="left" valign="middle" class="shopcartys">商品编号</td>
    <!-- <td width="120" align="center" valign="middle" class="shopcartys">返现</td> -->
    
    <td width="120" align="center" valign="middle" class="shopcartys">本店价</td>
    <td width="120" align="center" valign="middle" class="shopcartys">数量</td>
    <td width="120" align="center" valign="middle" class="shopcartys">操作</td>
  </tr> 
  
  <c:if test="${not empty cart.items}">
								<c:forEach var="item" items="${cart.items}"
									varStatus="idxStatus">
									
									<tr class=td_no_bord valign="middle">
										<td></td>
										<td >
										 <A title=商品图片 target="_blank"
											href="<c:url value="/goodMgr?act=showGood&goodNo=${item.good.goodsNo}"/>" name=purchase_bk style="width:50px">
											 <img id=img style="width: 100px; height: 100px;margin-feft:30px" title="商品图片" 
											 src="<c:url value="/goodMgr?act=get_pic"/>&g_no=${item.good.goodsNo}" border=0/> </A>
											<span style="margin-bottom:40px">${item.good.goodsName}  ${item.good.goodsMemo}</span>
										</td>
										 <td  align="center" valign="middle" >
											${item.good.goodsNo}
										 </td>
										<td  align="center" valign="middle" >
											￥${item.good.goodsPrice}
										</td>
										<td  align="center" valign="middle" >
										  <div class="p_number">
											<div class="f_l add_chose">
												
												<input type="text" name="goodNum${idxStatus.index}" id="goodNum" class="text" 
												       value=${item.goodNum } style="width:50px" readonly="readonly"/>
												
											 </div>
										   </div>
										</td>
										<td align="center" valign="middle">
											<span title="点击删除商品" onclick="removeGoodFromCar('${item.good.goodsNo}','${item.good.goodsName}');">
											    <img src="<c:url value="/img/trash.png"/>" border="0" />	
											</span>
										</td>

									</tr>
								</c:forEach>
							</c:if>
</table>
   </div>
   <!--[if !IE]>end<![endif]-->
   <div class="shopcart2">
   <div class="shopcart2_text">
   <h1>您选购了不同城市的商品将会产生运费：</h1>
   <h2>1、一起结算，满1000元免运费；</h2>
   </div>
   <div class="shopcart2_text101">
   
   <h1 id="totalNum"><span style="front-size:28px">共计：¥</span><span id="totalMoney">${cart.cartAmount}</span></h1>
   </div>
   </div>
   <div class="shopcart3">
   <div class="shopcart301"><br/>
     <a href="<c:url value="frontSecurityMgr?act=tomainmenu"/>">继续购物</a></div>
   <div class="shopcart302">
   <div class="shopcart302_text">
   <h1>(不含运费)</h1>
   <h2>总       计：</h2>
   <h3 id="totalMoneys">${cart.cartAmount}</h3>
   </div>
   						<DIV class=balance id=balance>

								<A href="<c:url value="/goodMgr?act=showBalance"></c:url>"
									name=checkout> 
								<IMG title=结算 alt=结算
										src="<c:url value="/img/butt_balance.gif" />" border=0/>
								</A>
							</DIV>
   </div>
   </div>
  
  </div>
  

  <!--[if !IE]>中间完成<![endif]
  <iframe width="100%" height="500" frameborder=0 scrolling="no" src="bottom.htm" style="padding-top:0px; overflow:hidden;"></iframe>
	-->
</div>


</body>
</html>
